#ifndef _SNAPSHOT_LOOP_H
#define _SNAPSHOT_LOOP_H

#include <asm/types.h>

#define LO_NAME_SIZE	64
#define LO_KEY_SIZE	32

struct loop_info64 {
	__u64		   lo_device;			/* ioctl r/o */
	__u64		   lo_inode;			/* ioctl r/o */
	__u64		   lo_rdevice;			/* ioctl r/o */
	__u64		   lo_offset;
	__u64		   lo_sizelimit;/* bytes, 0 == max available */
	__u32		   lo_number;			/* ioctl r/o */
	__u32		   lo_encrypt_type;
	__u32		   lo_encrypt_key_size;		/* ioctl w/o */
	__u32		   lo_flags;			/* ioctl r/o */
	__u8		   lo_file_name[LO_NAME_SIZE];
	__u8		   lo_crypt_name[LO_NAME_SIZE];
	__u8		   lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */
	__u64		   lo_init[2];
};

// FIXME: should support different block size...or not
#define LOOP_BLOCK_SIZE 4096
struct loop_block {
	__u32	index;
	__u32	len;
	__u8*	buf;
};

/*
 * IOCTL commands --- we will commandeer 0x4C ('L')
 */

#define LOOP_SET_FD		0x4C00
#define LOOP_CLR_FD		0x4C01
#define LOOP_SET_STATUS		0x4C02
#define LOOP_GET_STATUS		0x4C03
#define LOOP_SET_STATUS64	0x4C04
#define LOOP_GET_STATUS64	0x4C05
#define LOOP_CHANGE_FD		0x4C06
#define LOOP_WLIMIT_START	0x4C10
#define LOOP_WLIMIT_STOP	0x4C11
#define LOOP_RLIMIT_START	0x4C12
#define LOOP_RLIMIT_STOP	0x4C13
#define LOOP_SYNC_BLOCK		0x4C14

#endif
